# Data Model

Data model editor provides the code-first experience for building and enhancing the
[data model][ref-data-modeling] of your semantic layer from within your web browser.

Unlike the [Visual Model][ref-visual-model] editor, it provides the freedom to use all
available data modeling features at the expense of a code-centric experience.

<SuccessBox>

Data model editor is available in Cube Cloud on
[all product tiers](https://cube.dev/pricing).

</SuccessBox>

Cube Cloud can create branch-based development API instances to quickly test
changes in the data model in your frontend applications before pushing them into
production.

<LoomVideo url="https://www.loom.com/embed/101b6291b0ba4d1d8982faa3b8c5bd55" />

## Development Mode

In development mode, you can safely make changes to your project without
affecting production deployment. Development mode uses a separate Git branch and
allows testing your changes in Playground or via a separate API endpoint
specific to this branch. This development API hot-reloads your data model
changes, allowing you to quickly test API changes from your applications.

To enter development mode, navigate to the <Btn>Data Model</Btn> screen and
click <Btn>Dev Mode</Btn>.

<Screenshot
  src="https://ucarecdn.com/a35aefc4-8065-4641-a79d-d441d2789c55/"
  alt="Entering dev mode"
/>

If you are entering development mode from the main branch, you will be asked to
choose an existing branch or create a new one. You can configure whether it's possible
to commit directly to the main branch in the deployment settings.

<Screenshot
  src="https://ucarecdn.com/68ed5627-ab7f-4d16-8dc4-90e48c0e6216/"
  alt="Entering dev mode modal"
/>

When development mode is active, the status of the development API will be shown
at the top of the screen. After any changes to the project, the API
will hot-reload, and the API status will indicate when it's ready.

You can exit development mode by clicking <Btn>Dev Mode X</Btn> in the purple banner. If
you've been editing a data model and navigate away, Cube Cloud will warn you if
there are any unsaved changes:

<Screenshot
  src="https://ucarecdn.com/67b8e943-0043-4398-84fc-91d83765ed10/"
  alt="Unsaved changes warning modal"
/>

## Git integration

To add more Git branches to your Cube Cloud deployment and/or switch between
them, click the branch name in the status bar:

<Screenshot
  src="https://ucarecdn.com/a3ea164f-b93c-4c83-b7a3-697dd025b74a/"
  alt="Branch switcher"
/>

Speaking of Git branches, you can now easily add and remove branches with the
same switcher; click <Btn>Add Branch</Btn> and enter a name for the new branch
in the popup:

<Screenshot
  src="https://ucarecdn.com/15ea528f-4a54-40a1-83c7-2f67738a3e8b/"
  alt="Create a new branch"
/>

These branches are shared, meaning everyone who has access to the deployment can
see and edit them. This makes them extremely useful for out-of-band experiments
where you can quickly test things in Cube Cloud without having to go through a
CI/CD process.

Unused branches can also be deleted. Ensure you are already on the branch you
want to delete, then open the switcher and click <Btn>Remove Branch</Btn>:

<Screenshot
  src="https://ucarecdn.com/f1d37fe6-a6ae-4d78-a801-133639daf1ec/"
  alt="Delete a branch"
/>

## Generating data model files

You can generate data model files when [creating a new
deployment][ref-creating-deployment] or at later moment. To open the data model
wizard, click on the <Btn>...</Btn> button on the right and select <Btn>Generate
data model</Btn>:

<Screenshot
  highlight="inset(17.5% 0 50% 80% round 10px)"
  src="https://ucarecdn.com/0f9684c2-a7f5-48a2-9fac-32e050beba5d/"
/>

It is safe to generate data model files for tables that already have matching cubes.
In that case, existing files will be renamed by appending `.backup` to their names.
You would also be able to review changes to files on the <Btn>Changes</Btn> tab:

<Screenshot src="https://ucarecdn.com/a8d53348-8441-41f3-969c-df46d41d78b6/" />


## Creating pre-aggregations

If you'd like to use the UI to create a pre-aggregation, you can click on the
<Btn>...</Btn> button on the right and select <Btn>Add rollup</Btn> to open
[Rollup Designer][ref-rollup-designer]:

<Screenshot
  highlight="inset(17.5% 0 50% 80% round 10px)"
  src="https://ucarecdn.com/0f9684c2-a7f5-48a2-9fac-32e050beba5d/"
/>

[ref-data-modeling]: /product/data-modeling/overview
[ref-rollup-designer]: /product/workspace/rollup-designer
[ref-creating-deployment]: /product/deployment/cloud/deployments#creating-a-new-deployment
[ref-visual-model]: /product/workspace/visual-model